/*
 * Copyright (c) 2020. By WoodData
 *
 *
 * Change Logs:
 * Date           Author       Notes

 */
#ifndef		__LCD_DRIVER__H_
#define		__LCD_DRIVER__H_



#include "lcd_adapter.h"
#include "fsl_debug_console.h"

#define		LCD_W		320
#define		LCD_H		480


#define GLCD_WIDTH      LCD_W     /* Screen Width  (in pixels) */
#define GLCD_HEIGHT     LCD_H     /* Screen Height (in pixels) */

/*---------------------- Graphic LCD color definitions -----------------------*/
/* Color coding (16-bit): 
     15..11 = R4..0 (Red)
     10..5  = G5..0 (Green)
      4..0  = B4..0 (Blue)
*/

/* GLCD RGB color definitions                            */
#define GLCD_COLOR_BLACK        0x0000  /*   0,   0,   0 */
#define GLCD_COLOR_NAVY         0x000F  /*   0,   0, 128 */
#define GLCD_COLOR_DARK_GREEN   0x03E0  /*   0, 128,   0 */
#define GLCD_COLOR_DARK_CYAN    0x03EF  /*   0, 128, 128 */
#define GLCD_COLOR_MAROON       0x7800  /* 128,   0,   0 */
#define GLCD_COLOR_PURPLE       0x780F  /* 128,   0, 128 */
#define GLCD_COLOR_OLIVE        0x7BE0  /* 128, 128,   0 */
#define GLCD_COLOR_LIGHT_GREY   0xC618  /* 192, 192, 192 */
#define GLCD_COLOR_DARK_GREY    0x7BEF  /* 128, 128, 128 */
#define GLCD_COLOR_BLUE         0x001F  /*   0,   0, 255 */
#define GLCD_COLOR_GREEN        0x07E0  /*   0, 255,   0 */
#define GLCD_COLOR_CYAN         0x07FF  /*   0, 255, 255 */
#define GLCD_COLOR_RED          0xF800  /* 255,   0,   0 */
#define GLCD_COLOR_MAGENTA      0xF81F  /* 255,   0, 255 */
#define GLCD_COLOR_YELLOW       0xFFE0  /* 255, 255, 0   */
#define GLCD_COLOR_WHITE        0xFFFF  /* 255, 255, 255 */




uint32_t lcd_init(void);

void lcd_point(uint16_t x, uint16_t y,uint16_t color);
void lcd_fill(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end, uint16_t color);
void lcd_fill_buff(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end,const uint8_t *buff);
void lcd_fill_buff_rgba8888(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end,const uint8_t *buff);
void lcd_fill_buff_rgb888(uint16_t x_start, uint16_t y_start, uint16_t x_end, uint16_t y_end,const uint8_t *buff);
void lcd_char_dot(uint16_t x, uint16_t y, uint16_t w, uint16_t h,const uint8_t *buff,uint16_t f_color,uint16_t b_color);

void lcd_h_line(uint16_t x1, uint16_t y1, uint16_t x2,uint16_t color);
void lcd_v_line(uint16_t x1, uint16_t y1, uint16_t y2,uint16_t color);
void lcd_line(uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2,uint16_t color);
void lcd_draw_rect(uint16_t x,uint16_t y,uint16_t w,uint16_t h,uint16_t c);
void lcd_fill_rect(uint16_t x_start, uint16_t y_start, uint16_t width, uint16_t height, uint16_t color);
void lcd_draw_circle(uint16_t x0, uint16_t y0, uint16_t r,uint16_t c);
void lcd_clear(uint16_t color);

uint8_t lcd_open_window(uint16_t x, uint16_t y, uint16_t width, uint16_t height);
void lcd_show_image(uint16_t x, uint16_t y, uint16_t width, uint16_t height, const uint8_t *image);

#endif      //__LCD_DRIVER__H_

